/*
 *  PacketFactory.h
 *  TubeTruck
 *
 *  Created by Aeturnum on 6/4/08.
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
 *
 */

#include <vector>
#include "Packet.h"
#include "OHAI.h"
#include "NOWAI.h"
#include "IIS.h"
#include "CANHAS.h"
#include "LAWL.h"
#include "DOWANT.h"
#include "HASFLAVR.h"
#include "CHEEZBURGER.h"

namespace TTP {
   Packet* getPacket(std::vector<byte>& data) {
      Packet * retVal;
      mType = data[4];
      switch(mType) {
         case Packet_OHAI:
            retVal = new OHAI();
            break;
         case Packet_NOWAI:
            retVal = new NOWAI();
            break;
         case Packet_IIS:
            retVal = new IIS();
            break;
         case Packet_DOWANT:
            retVal = new DOWANT();
            break;
         case Packet_HASFLAVR:
            retVal = new HASFLAVR();
            break;
         case Packet_LAWL:
            retVal = new LAWL();
            break;
         case Packet_CANHAS:
            retVal = new CANHAS();
            break;
         case Packet_CHEEZBURGER:
            retVal = new CHEEZBURGER();
            break;
      }
      retVal->fromVec(data);
      return retVal;
   }
}